package com.example.analysis.controller;

import com.example.analysis.domain.ScoreInfo;
import com.example.analysis.domain.SemesterStatistic;
import com.example.analysis.dto.CourseStatsDTO;
import com.example.analysis.entity.Class;
import com.example.analysis.entity.EvaluateListStudent;
import com.example.analysis.service.CourseStatsService;
import com.example.analysis.service.ElectionService;
import com.example.analysis.service.EvaluateListStudentService;
import com.example.analysis.service.StudentService;
import com.example.analysis.utils.Response1;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentAnalysis {
    @Resource
    StudentService studentService;
    @Resource
    ElectionService electionService;
    @Resource
    CourseStatsService statsService;
    @Resource
    EvaluateListStudentService evaluateListStudentService;

   @GetMapping("/fluctuate")
    public Response1<List<CourseStatsDTO>> getFluctuate(String semester){

       return statsService.getCourseStats(semester);
   }


    @GetMapping("/dev")
    public Response1<List<ScoreInfo>> getDev(@RequestParam("selectCourseId") String selectCourseId, @RequestParam("selectClassId") String selectClassId){
        List<ScoreInfo> list=electionService.getSelectAll(selectCourseId, selectClassId);
        Response1<List<ScoreInfo>> listResponse1 = new Response1<>(20000, "成功", list);
        return listResponse1;
    }

    @GetMapping("/course/{semester}")
    public Response1<List<ScoreInfo>> getCourse(@PathVariable("semester") String semester){
        List<ScoreInfo> list=electionService.getCourse(semester);
        Response1<List<ScoreInfo>> listResponse1 = new Response1<>(20000, "成功", list);
        return listResponse1;
    }

    @GetMapping("/{id}")
    public Response1<List<Class>> getClass(@PathVariable("id") String subId){
        List<Class> list=electionService.getByClassId(subId);
        Response1<List<Class>> listResponse1 = new Response1<>(20000, "成功", list);
        return listResponse1;
    }

    @GetMapping("/list")
    public Response1<List<ScoreInfo>> list(ScoreInfo scoreInfo){
       List<ScoreInfo> infoList=electionService.getList(scoreInfo);
        Response1<List<ScoreInfo>> listResponse1 = new Response1<>(20000, "成功", infoList);
        return listResponse1;
    }

    @GetMapping("/diffClass")
    public Response1<List<ScoreInfo>> diffClass(ScoreInfo scoreInfo){
        List<ScoreInfo> infoList=electionService.diffClass(scoreInfo);
        Response1<List<ScoreInfo>> listResponse1 = new Response1<>(20000, "成功", infoList);
        return listResponse1;
    }

    @GetMapping("/diffSemester")
    public Response1<List<SemesterStatistic>> diffSemester(ScoreInfo scoreInfo){
        List<SemesterStatistic> infoList=electionService.diffSemester(scoreInfo);
        Response1<List<SemesterStatistic>> listResponse1 = new Response1<>(20000, "成功", infoList);
        return listResponse1;
    }


}
